<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页二</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-warning icon"></i>监控功能</div>
                    <div class="layui-card-body">
                        <div class="welcome-module">
                            <div class="layui-row layui-col-space10">
                                <form class="layui-form" action="" lay-filter="Quartz">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">bilibili监控</label>
                                        <div class="layui-input-block">
                                            <input type="checkbox" name="BiliBili_on_off" lay-skin="switch" lay-filter="switch_bilibili" lay-text="ON|OFF">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">随机二次元监控</label>
                                        <div class="layui-input-block">
                                            <input type="checkbox" name="AcgRandomImg_on_off" lay-skin="switch" lay-filter="switch_AcgRandomImg" lay-text="ON|OFF">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">微博热搜</label>
                                        <div class="layui-input-block">
                                            <input type="checkbox" name="WeiboMonitor_on_off" lay-skin="switch" lay-filter="switch_WeiboMonitor" lay-text="ON|OFF">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">语音报时</label>
                                        <div class="layui-input-block">
                                            <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-credit-card icon icon-blue"></i>其他功能</div>
<!--                   空着-->
                </div>
            </div>
            <div class="layui-col-md12">
            </div>
        </div>
    </div>
</div>
<script src="/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form','jquery','layer'], function () {
        var $ = layui.jquery
            ,form = layui.form
            , layer = layui.layer;
        $.ajax({url: "/getQuartDataState",async: false,cache: false,
                type: "GET",headers: {"token":localStorage.getItem("token")},
                success: function (data) {
                    form.val('Quartz', data);
                },error: function (e) {layer.msg("请求错误！");}
        });
        form.on('switch(switch_bilibili)', function () {
            $.ajax({url: "/Quartz_BiliBili",async: false,cache: false,
                type: "GET",headers: {"token":localStorage.getItem("token")},
                success: function (data) {
                    if(data.BiliBili_on_off==1) {
                        layer.msg('已开启',{offset: '6px'});
                    }else{
                        layer.msg('已关闭',{offset: '6px'});
                    }
                },error: function (e) {layer.msg("请求错误！");}
            });
        });
        form.on('switch(switch_AcgRandomImg)', function () {
            $.ajax({url: "/Quartz_AcgRandomImg/30",async: false,cache: false,
                type: "GET",headers: {"token":localStorage.getItem("token")},
                success: function (data) {
                    if(data.BiliBili_on_off==1) {
                        layer.msg('已开启',{offset: '6px'});
                    }else{
                        layer.msg('已关闭',{offset: '6px'});
                    }
                },error: function (e) {layer.msg("请求错误！");}
            });
        });
        form.on('switch(switch_WeiboMonitor)', function () {
            $.ajax({url: "/Quartz_Weibo",async: false,cache: false,
                type: "GET",headers: {"token":localStorage.getItem("token")},
                success: function (data) {
                    if(data.BiliBili_on_off==1) {
                        layer.msg('已开启',{offset: '6px'});
                    }else{
                        layer.msg('已关闭',{offset: '6px'});
                    }
                },error: function (e) {layer.msg("请求错误！");}
            });
        });
    });
</script>
</body>
</html>
